package com.agailgi;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.KeyEvent;

import org.apache.cordova.*;

public class Agailgi_clientActivity extends DroidGap {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
        
    }
    
    @Override
    public boolean onKeyDown( int keyCode, KeyEvent event )
    {
    	if( keyCode == KeyEvent.KEYCODE_BACK )
    	{
    		confirmAppExit();
    		return true;
    	}
    	return super.onKeyDown(keyCode, event);
    }
    
    private void confirmAppExit(){
    	AlertDialog.Builder db = new AlertDialog.Builder(this);
    	db.setTitle("종료")
    	.setMessage("아가일기를 종료하시겠습니까?")
    	.setCancelable(true)
    	.setPositiveButton("확인", new OnClickListener(){
    		public void onClick(DialogInterface dialog, int which){
    			finish();
    		}
    	})
    	.setNegativeButton("취소",null)
    	.show();
    }
}